//
//  CreditLimitVC.m
//  BrushFace
//
//  Created by timer_q on 16/1/19.
//  Copyright © 2016年 Zzz. All rights reserved.
//

#import "CreditLimitVC.h"
#import "UserInfoCredit.h"

@interface CreditLimitVC ()

@end

@implementation CreditLimitVC

- (void)viewDidLoad {
    [super viewDidLoad];
    // Do any additional setup after loading the view from its nib.
    self.view.backgroundColor = [UIColor colorWithHEX:@"#efeff4" alpha:1];
   
    [self UIConfig];
}
- (void)viewWillAppear:(BOOL)animated{
    [super viewWillAppear:animated];
    [self DataInit];
}
- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}
#pragma mark - CustomMethods
- (void)UIConfig{
    [self.navBar setTitle:@"信用额度"];
    [self.navBar setNavBackColor:[UIColor clearColor]];
    [self.navBar setLeftBtn:NAV_BAR_LEFT_BTN_TYPE_WHITE];
}
- (void)DataInit{
    
    NSString *requestStr = [NSString stringWithFormat:@"%@/user/getusercreditinfo4app.json",SERVICE_ADRESS];
    AFHTTPRequestOperationManager *manager = [AFHTTPRequestOperationManager manager];
    manager.responseSerializer = [[AFHTTPResponseSerializer alloc] init];
    [manager GET:requestStr parameters:nil success:^(AFHTTPRequestOperation * _Nonnull operation, id  _Nonnull responseObject) {
        NSDictionary *json = [NSJSONSerialization JSONObjectWithData:responseObject options:0 error:nil];
        _creditLabel.text = [NSString stringWithFormat:@"%@",json[@"avalamount"]];
        _allCredit.text = [NSString stringWithFormat:@"%@",json[@"amount"]];
        
    } failure:^(AFHTTPRequestOperation * _Nullable operation, NSError * _Nonnull error) {
        
    }];

}
- (IBAction)improveUserInfo:(id)sender {
    UserInfoCredit *infovc = [[UserInfoCredit alloc] init];
    [infovc setHidesBottomBarWhenPushed:YES];
    [self.navigationController pushViewController:infovc animated:YES];
    
}

@end
